https://leetcode.cn/problems/map-of-highest-peak/description/
class Solution {
    typedef pair<int, int> PII;
    int dx[4] = {0, 0, 1, -1};
    int dy[4] = {1, -1, 0, 0};

public:
    vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {
        int m = isWater.size(), n = isWater[0].size();
        vector<vector<int>> vis(m, vector<int>(n, -1));

        queue<PII> q;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (isWater[i][j]) {
                    q.push({i, j});
                    vis[i][j] = 0;
                }
            }
        }

        while(!q.empty())
        {
            auto [a,b]=q.front();
            q.pop();
            for(int i=0;i<4;i++)
            {
                int x=dx[i]+a,y=dy[i]+b;
                //未标记
                if(x>=0&&x<m && y>=0&& y<n && vis[x][y]==-1)
                {
                    vis[x][y]=vis[a][b]+1;
                    q.push({x,y});
                }
            }
        }
        return  vis; 
    }
};